<?php
header('Content-Type:text/html;charset=utf-8');
require('./zscg.php');
require('./local.php');
@$res=select($con,'user','where `username` = "'.$_POST['username'].'"')[0];
if($_POST['username'] == $res['username'] && md5($_POST['password']) == $res['password']){
    echo "<script>window.location.href='/home/index.php'</script>";
    setcookie("username",$res['username'],0,'/');
    setcookie("password",$res['password'],0,'/');
}else{
    echo "<script>alert('登录失败');window.location.href='/index.php'</script>";
    setcookie("username",'',0,'/');
    setcookie("password",'',0,'/');
}
